﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.System;
using Windows.UI;
using Windows.UI.ApplicationSettings;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Infrastructure.UI;

namespace Flashlight
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();

            this.EnablePrivacyPolicy(PrivacyPolicy.RunXiaDianQi);
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            powerToggleSwitch_Toggled(this, new RoutedEventArgs());
        }

        private void powerToggleSwitch_Toggled(object sender, RoutedEventArgs e)
        {
            if (powerToggleSwitch == null)
                return;

            if (powerToggleSwitch.IsOn)
            {
                MainGrid.Background = new SolidColorBrush(Colors.White);
            }
            else
            {
                MainGrid.Background = new SolidColorBrush(Colors.Black);
            }
        }
    }
}
